package db;

import java.util.*;

import org.xml.sax.helpers.DefaultHandler;

//////////////////////////////////////////////////////////////////////////
//// CompositeActorDB
/**
@author Ivan Jeukens
@version v 0.1 23/1/2002
*/
public class CompositeActorDB extends DataBase {

    public CompositeActorDB() {
        super();
    }

    ///////////////////////////////////////////////////////////////////
    ////                        public methods                     ////

    public void setAtomicActorDataBase(AtomicActorDB atomicActorDB) {
        _atomicActorDB = atomicActorDB;
    }

    public dbInfo getInfo(String name) {
        dbInfo ret = null;
        if(!_data.containsKey(name)) return null;

        Object obj = _data.get(name);
        ret = (dbInfo) obj;
        
        /*
        if(obj instanceof dbInfoSummary) {
            CompositeActorInfo info = new CompositeActorInfo(_atomicActorDB, name);
            info.load(_basePath);
            _data.put(name, info);
            ret = info;
        }
        else {
            ret = (dbInfo) obj;
        } */

        /*
        if(ret == null) {
            // Representa um subnivel da hierarquia. Entao tem que construir
            CompositeActorInfo info = new CompositeActorInfo(_atomicActorDB, name);            
            info.load(_basePath);
            _data.put(name, info);
            ret = info;
        }
        else {
            // Nesse caso eu ja criei a CompositeActorInfo no load da database,
            // mas ainda nao carreguei nada.
            CompositeActorInfo info = (CompositeActorInfo) ret;
            info.load(_basePath);
            _data.put(name, info);
            ret = info;
        } */

        return ret;
    }

    ///////////////////////////////////////////////////////////////////
    ////                        private methods                    ////

    ///////////////////////////////////////////////////////////////////
    ////                        private variables                  ////

    private AtomicActorDB _atomicActorDB;
}
